package com.jh.calendarjh;

import java.util.Calendar;

public class APICal 
{
	public void printCal(int year,int month)
	{
		Calendar cal = Calendar.getInstance();
		
		cal.set(year, month-1, 1);
		int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
		int totalDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
		
		
		
		System.out.printf("\t\t %d년 \t %d월\n",year,month);
		System.out.println("일 \t월 \t화 \t수 \t목 \t금\t토 ");
		
		//공백 찍기
		for (int i = 1; i < dayOfWeek; i++) 
		{
			System.out.print("-\t");
		}
		
		for (int i = 1; i <= totalDay; i++) 
		{
			System.out.print(i+"\t");
			if ((i+dayOfWeek-1)%7 == 0) 
			{
				System.out.println();
			}
		}
	}
}
